define(function(require, exports, module) {
	'use strict';
    
    var rk = require('rk');
    require('../../su/xsySuRefer/widget');

    $.widget('rk.xsyCompetitorRefer', $.rk.xsySuRefer, {
        options: {
            iconClass: 'xsy_su_refer_competitor_icon',
            business: 'competitor',
            createAct: 'addCompetitor'
        },
        _create: function(){
            var me = this;
            var elem = me.element;
            var opt = me.options;

            me._super();

            me._reload();
        },
        _reload: function(){
            var me = this;
            var elem = me.element;
            var opt = me.options;
            var fromBelongId = opt.parentEntityId;
            var fromDataId = me._getDetailId();
            var fromItemId = opt.referItemId;

            me._loadData({}, function (result){

                var config = {
                    iconClass: opt.iconClass,
                    linkOfMore: '/competitor.action?fromBelongId=' + fromBelongId + "&fromDataId=" + fromDataId + "&fromItemId=" + fromItemId,
                    linkOfFinal: '/final/competitor.action?id={{id}}',
                    buttons: ['create'],
                    children: [
                        {   
                            type: 'card'
                        },
                        {   
                            type: 'grid'
                        }
                    ],
                   
                    isFold: false
                };

                me._render(config, result);
            });
        }
    });
});